package Chuong07;

import java.io.*;
import java.util.Scanner;


public class Bai03 {

	ObjectOutputStream write;
	SinhVien SV;
	BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	
	String path = "D:/Hoc Tap/Hoc Ki VII/Chuyen De Java/OnTap_Code/OnTap/src/Chuong07/File/";
	//String path = "Z:/";
	
	public Bai03(){
		
		try {
			write = new ObjectOutputStream(
					new FileOutputStream(path + "DanhSach.dat"));
			int nSL;
			
			System.out.print("Số lưọng sinh viên: ");
			nSL = Integer.parseInt(in.readLine());
			
			for(int i = 0;  i < nSL; i++){
				System.out.println("Sinh viên thứ " + (i+1) + ":");
				SV = new SinhVien();
				SV.SetSV(in);
				write.writeObject(SV);
			}
			
			
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	public static void main(String[] args) {
		new Bai03();
	}

}
